-
Notifications
You must be signed in to change notification settings - Fork 0
Replace tsup with tsc #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes update several configuration files, package scripts, and module import/export paths across the repository. Notably, a new TypeScript setting for module specifiers is added and the base TypeScript configurations are switched to a React-specific variant in multiple projects. Package scripts have been streamlined by removing “check” scripts and adjusting build commands. Additionally, a new Vite plugin for removing import attributes is integrated into the browser extension’s build process, and multiple tsup configurations have been removed. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Vite as Vite Build Process
participant Plugin as removeImportAttributes Plugin
Dev->>Vite: Initiate build process
Vite->>Plugin: Invoke removeImportAttributes during pre-transformation
Plugin-->>Vite: Return transformed code (import attributes removed)
Vite-->>Dev: Complete build with updated modules
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/helpers/tsconfig.json (1)
1-1: Streamline TypeScript Configuration
Removing thecompilerOptionssection simplifies the configuration by deferring to the base settings intsconfig.base.json. Please verify that no package-specific compiler options are needed for this helper package.package.json (1)
14-14: Updated prepare script to include ts-patch installation.
The"prepare"script now runs"husky & ts-patch install", which reflects the removal of tsup in favor of the new patching strategy. Please verify that using the ampersand (&) works consistently across all target environments; if sequential execution is intended, you might consider using&&instead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (44)
.vscode/settings.json(1 hunks)apps/browser-extension/package.json(0 hunks)apps/browser-extension/tsconfig.json(1 hunks)apps/browser-extension/vite-plugins.ts(1 hunks)apps/browser-extension/vite.config.chrome.ts(1 hunks)apps/browser-extension/vite.config.firefox.ts(1 hunks)apps/discord-bot/package.json(1 hunks)apps/discord-bot/tsconfig.json(1 hunks)apps/website/package.json(0 hunks)apps/website/tsconfig.json(1 hunks)biome.json(1 hunks)package.json(1 hunks)packages/components/package.json(1 hunks)packages/components/src/carousel.tsx(1 hunks)packages/components/src/form.tsx(1 hunks)packages/components/tsconfig.json(1 hunks)packages/components/tsup.config.ts(0 hunks)packages/engine/package.json(1 hunks)packages/engine/src/execute/fetch.ts(1 hunks)packages/engine/src/execute/index.ts(1 hunks)packages/engine/src/runtimes/fetch.ts(1 hunks)packages/engine/src/runtimes/getters.ts(1 hunks)packages/engine/src/runtimes/index.ts(1 hunks)packages/engine/tsconfig.json(1 hunks)packages/engine/tsup.config.ts(0 hunks)packages/helpers/package.json(1 hunks)packages/helpers/src/better-fetch/better-fetch.ts(1 hunks)packages/helpers/src/better-fetch/index.ts(1 hunks)packages/helpers/src/create-logger/create-logger.ts(1 hunks)packages/helpers/src/create-logger/index.ts(1 hunks)packages/helpers/tsconfig.json(1 hunks)packages/helpers/tsup.config.ts(0 hunks)packages/hooks/package.json(1 hunks)packages/hooks/src/event-callback.ts(1 hunks)packages/hooks/src/event-listener.ts(1 hunks)packages/hooks/src/media-query.ts(1 hunks)packages/hooks/tsup.config.ts(0 hunks)packages/shapes/package.json(1 hunks)packages/shapes/src/index.ts(1 hunks)packages/shapes/src/runtime.ts(1 hunks)packages/shapes/tsconfig.json(1 hunks)packages/shapes/tsup.config.ts(0 hunks)tsconfig.base.json(1 hunks)tsconfig.react.json(1 hunks)
💤 Files with no reviewable changes (7)
- apps/website/package.json
- packages/helpers/tsup.config.ts
- packages/shapes/tsup.config.ts
- packages/engine/tsup.config.ts
- packages/hooks/tsup.config.ts
- packages/components/tsup.config.ts
- apps/browser-extension/package.json
🧰 Additional context used
🧬 Code Definitions (2)
apps/browser-extension/vite.config.firefox.ts (1)
apps/browser-extension/vite-plugins.ts (2)
removeExternalScriptLoading(18-45)removeImportAttributes(50-58)
apps/browser-extension/vite.config.chrome.ts (1)
apps/browser-extension/vite-plugins.ts (2)
removeExternalScriptLoading(18-45)removeImportAttributes(50-58)
🔇 Additional comments (45)
apps/discord-bot/tsconfig.json (1)
1-2: Minimal tsconfig: Validate Extended ConfigurationThe tsconfig for the discord-bot app has been pared down to only extend
"../../tsconfig.base.json". Please verify that all necessary compiler options—as well as file inclusion/exclusion rules—are properly defined in the base config so that the project compiles as expected.packages/components/src/form.tsx (1)
14-14: Explicit File Extension in ImportThe import for the
Labelcomponent now explicitly references./label.jsx, which improves clarity regarding the file type and aligns with the new module resolution strategy. Please confirm that the file’s naming and extension are consistent across the codebase.apps/discord-bot/package.json (2)
15-17: Review Build Script CommandThe
"build"script has been updated to"pnpm tsup". Considering the PR objective to replace tsup with tsc, please verify that this command is intentionally retained for the Discord bot or if it should be updated to use tsc to ensure consistency across projects.
24-27: Dependency Reintroduction ConfirmationThe
es-toolkitpackage is reintroduced with version"^1.32.0". Confirm that this version is compatible with the current codebase and that its reintroduction was intentional given the overall dependency and build process adjustments.packages/hooks/src/media-query.ts (1)
2-2: Explicit Module Resolution for HookThe import statement for
useIsomorphicLayoutEffectnow includes the.jsextension. This explicit declaration improves module resolution clarity and is consistent with the new configuration standards. Ensure this pattern is uniformly applied where necessary.packages/helpers/src/create-logger/create-logger.ts (1)
1-1: Explicit File Extension in Logger ImportThe update to import
hexToAnsifrom'./hex-to-ansi.js'enhances clarity by explicitly stating the file type. This change aligns well with the new module specifier settings and should help prevent potential resolution issues.packages/hooks/src/event-callback.ts (1)
2-2: Enforce Explicit Module Resolution with File Extension
Updating the import to include the.jsextension helps ensure that module resolution works consistently in ESM environments. Verify that this change is applied uniformly across similar modules..vscode/settings.json (1)
30-30: Add TypeScript Import Specifier Preference Setting
The new setting"typescript.preferences.importModuleSpecifierEnding": "js"enforces explicit file extensions for module imports in TypeScript files, aligning with the updated module resolution strategy across the project.packages/engine/tsconfig.json (1)
1-1: Utilize Base Configuration for Consistency
By eliminating the localcompilerOptionssection, this configuration now entirely relies on the base settings defined in../../tsconfig.base.json. Confirm that this does not remove any critical options that the engine package might require.packages/engine/src/execute/index.ts (1)
1-1: Update Export Statement to Use Explicit Extension
Changing the export statement toexport * from './fetch.js';aligns with the project's new module resolution strategy by explicitly specifying the file extension. Ensure that the generated JavaScript filefetch.jsexists or is properly produced as part of the build process.packages/shapes/src/runtime.ts (1)
2-2: Explicit File Extension in Import Statement
The update now explicitly includes the.jsextension in the import (import { ExecuteOptions } from './execute.js';). This change promotes consistency with the new module resolution strategy and avoids ambiguity during TypeScript compilation (especially relevant since you're transitioning from tsup to tsc).packages/helpers/src/better-fetch/index.ts (1)
1-1: Explicit Export with File Extension
The export statement has been updated to explicitly reference'./better-fetch.js'. This helps ensure that module resolution is unambiguous under the updated TypeScript setup and aligns with the overall changes to module specifiers across the project.packages/helpers/src/create-logger/index.ts (1)
1-1: Updated Export to Include File Extension
Changing the export toexport * from './create-logger.js';clearly specifies the file to be imported at runtime. This explicit mode complements the new TS configuration and removes potential resolution issues.packages/components/src/carousel.tsx (1)
9-9: Explicit Import File Extension for Button Component
The Button component import has been modified to include the.jsxextension (import { Button } from './button.jsx';). This adjustment is in line with the project-wide push for explicit file extensions, ensuring reliable module resolution under TSC.packages/shapes/tsconfig.json (1)
1-1: Simplify and Centralize TypeScript Configuration
The removal of the localcompilerOptionssection—leaving only the"extends": "../../tsconfig.base.json"—simplifies this package’s TS configuration and centralizes configuration management. Please verify that all previously needed compiler options are now appropriately defined in the base configuration, to prevent any unintended side effects during compilation with tsc.tsconfig.react.json (1)
1-7: New React TypeScript Configuration File AddedThis file correctly extends the base configuration and sets
"jsx": "preserve", ensuring that JSX is not transformed. It centralizes React-specific TypeScript settings for consistent use across projects.packages/hooks/package.json (1)
10-12: Updated Build Script to Use tscThe build script has been changed from using tsup to directly invoking tsc, which aligns perfectly with the PR objective to replace tsup with tsc and simplifies the build process.
biome.json (1)
2-3: Simplified Ignore List ConfigurationThe "files" section now only ignores "node_modules/", "dist/", and ".next/*", which streamlines the configuration. This reduces complexity by filtering out only the essential directories.
packages/shapes/package.json (1)
14-16: Adjusted Build Script for Shapes PackageThe build script is updated to
"build": "tsc", replacing the previous tsup invocation. This change matches the project-wide shift to TypeScript’s compiler for the build process.packages/helpers/src/better-fetch/better-fetch.ts (1)
1-1: Explicit Import Extension for Module ResolutionThe updated import with the explicit
.jsextension improves module resolution in ESM environments and maintains consistency with the broader update across the codebase.packages/components/tsconfig.json (1)
1-1: Good switch to React-specific configuration.Updating the configuration to extend from
tsconfig.react.jsonis appropriate for a React components package. This change aligns with the PR's objective of replacing tsup with tsc and ensures that the components package has the correct TypeScript settings for React development.packages/hooks/src/event-listener.ts (1)
2-2: Proper addition of the .js extension for ESM compatibility.Adding the
.jsextension to the import path is necessary for ESM compatibility, as ES modules require explicit file extensions in import statements. This change aligns with the TypeScript setting"typescript.preferences.importModuleSpecifierEnding": "js"mentioned in the PR summary.apps/browser-extension/vite-plugins.ts (1)
47-58:Details
❓ Verification inconclusive
Good addition of plugin to handle import attributes.
The
removeImportAttributesplugin is a useful addition for stripping the newer JavaScriptwithimport attributes syntax, which might not be supported in all browser environments. This is particularly important for browser extensions where compatibility is crucial.The regex pattern looks functional for most common cases, but consider testing with various import statement formats to ensure it handles all edge cases correctly.
🏁 Script executed:
#!/bin/bash # Test the regex pattern against various import statement formats # Create a temporary file with different import statement patterns cat << EOF > test_imports.js import foo from 'bar'; import foo from 'bar' with { type: 'json' }; import foo from "bar" with { type: 'json' }; import foo from "bar" with { type: "json" }; import { foo } from 'bar' with { type: 'json' }; import { foo, bar } from 'bar' with { type: 'json', assert: 'value' }; // Comment before import import foo from 'bar' with { type: 'json' }; // Comment after import import foo from 'bar' with { type: 'json' }; // With whitespace import foo from 'bar' /*comment*/ with { type: 'json' }; EOF # Apply the regex transform manually echo "Testing regex transformation results:" echo "======================================" cat test_imports.js | sed -E 's/(from\s['\"](?:.*?)['\"])(\swith\s\{.*?\})/\1/g' echo "======================================" # Clean up rm test_imports.jsLength of output: 441
Manual Verification Needed: Import Attribute Plugin Regex
Nice addition of the plugin for stripping the newer JavaScript
withimport attributes. The regex appears to work for common cases, but further testing is required to ensure it correctly handles all edge cases—including varied quoting, whitespace, and inline comments.
- The provided test script produced a syntax error due to quoting issues with the sed command. Consider adjusting the sed command (e.g., using different delimiters or proper escaping) when testing the regex.
- Please manually verify the regex with additional examples to confirm it handles formats like inline comments, extra whitespace, and mixed quoting.
apps/browser-extension/vite.config.chrome.ts (2)
8-11: Properly structured imports with appropriate naming.The imports are well-organized, using a named import structure that clearly shows the two plugin functions being imported from the vite-plugins file.
16-16: Correct integration of the new import attributes plugin.The
removeImportAttributes()plugin is appropriately placed in the plugins array, right after the existingremoveExternalScriptLoading()plugin. Both plugins useenforce: 'pre'so this ordering is logical.packages/engine/src/runtimes/index.ts (1)
1-2: Updated export paths to include .js extensionThese changes are necessary for proper ESM compatibility when using
tscinstead oftsup. Adding explicit.jsextensions ensures correct module resolution in the compiled output.apps/browser-extension/vite.config.firefox.ts (2)
8-11: Import structure updated to include the new removeImportAttributes pluginClean import structure that properly groups the related Vite plugins from the local file.
16-16: Added removeImportAttributes plugin to handle import attributesThis addition helps to remove
withattributes from import statements, which is necessary after switching fromtsuptotsc. The plugin placement in the array is appropriate, running early in the transformation chain.packages/engine/package.json (1)
14-14:Details
✅ Verification successful
Build command updated from tsup to tsc
This change aligns with the PR's goal of replacing tsup with tsc for the build process. The "check" script has been removed, which is consistent with the approach taken across the repository.
🏁 Script executed:
#!/bin/bash # Verify if there are any tsconfig.json options that might need adjusting # after the change from tsup to tsc # Check for tsconfig.json in the same directory if [ -f "packages/engine/tsconfig.json" ]; then echo "Found tsconfig.json in packages/engine, checking contents:" cat packages/engine/tsconfig.json else echo "No tsconfig.json found in packages/engine, looking for parent configs:" find . -name "tsconfig.json" -type f -not -path "./node_modules/*" | xargs cat fi # Check if there was a tsup.config.ts file that had special options find packages/engine -name "tsup.config.ts" -type fLength of output: 299
Action Required: Verification Confirmed for Build Command Update
The build command change from tsup to tsc has been verified. The local
tsconfig.jsoninpackages/engineextends from../../tsconfig.base.json, and notsup.config.tsexists in the package, confirming that no special tsup-specific options need translation. The removal of the "check" script is consistent with the repository-wide approach.packages/helpers/package.json (1)
16-16: Build command updated from tsup to tscThe build script has been updated to use TypeScript's compiler directly instead of tsup, consistent with the PR's objective. This aligns with the changes made in other packages.
packages/engine/src/execute/fetch.ts (1)
8-10: Explicit Import Extensions for Module Resolution
The updated import statements now explicitly include the.jsextension (i.e.~/runtimes/identifier.js,~/runtimes/index.js, and./arguments.js). This change ensures compatibility with ECMAScript module resolution and aligns with the updated build process.packages/components/package.json (2)
9-10: Updated Export Paths to JSX Files
The export configuration now directs consumers to./dist/*.jsxfor module resolution instead of./dist/*.js. Ensure that downstream tooling and bundlers are configured to handle JSX outputs accordingly.
14-14: Build Script Modification: Switching from tsup to tsc
The"build"script has been updated from usingtsupto callingtscdirectly. This change meets the PR objective of replacing tsup with the TypeScript compiler. Verify that this provides the expected build outputs and that any necessary TypeScript configurations are in place to handle your project’s requirements.packages/engine/src/runtimes/fetch.ts (1)
17-18: Consistent Local Module Imports with Explicit Extensions
The updated imports for local modules now include the.jsextension (i.e../getters.jsand./identifier.js). This change fosters consistency with the updated module resolution strategy across the codebase.apps/website/tsconfig.json (1)
2-3: React-Specific TypeScript Configuration Update
Updating the"extends"property to"../../tsconfig.react.json"and modifying the"include"array (to include"next-env.d.ts"and.next/types/**/*.ts) aligns this project with a React-specific TypeScript setup. Double-check that these changes integrate smoothly with the surrounding build and linting processes.packages/engine/src/runtimes/getters.ts (1)
1-4: Enhanced JSON Imports with Explicit Type Declarations
The JSON file imports have been updated to use thewith { type: 'json' }clause forRuntimeExamples,RuntimeExtensions,RuntimeIcons, andRuntimeNames. This explicit declaration improves clarity and ensures proper typing under ECMAScript module semantics.apps/browser-extension/tsconfig.json (1)
2-3: Updated 'extends' and inclusion settings in tsconfig.json.
The configuration now extends from../../tsconfig.react.jsonand limits its content to only the necessary"include"property. This streamlined setup suggests that a React-specific base config is now handling previously explicit compiler options. Please verify that no critical customizations (e.g., exclusions or specific compiler options) are lost in transit.packages/shapes/src/index.ts (1)
1-3: Explicitly specifying '.js' in export statements.
Changing the exports to reference.jsfiles helps align with module resolution requirements (especially given the"typescript.preferences.importModuleSpecifierEnding": "js"setting in your project). Confirm that all consumers of these modules are updated to import using the.jsextension.package.json (3)
6-6: New lint script added using Biome.
The addition of"lint": "biome check . --write"will enforce code style consistency. Ensure that Biome is properly configured across the repository to avoid unexpected linting behaviors.
22-22: New development dependency 'ts-patch' added.
Inclusion of"ts-patch": "^3.3.0"aligns with the PR’s objective of replacing tsup, enabling custom TypeScript transformations during installation. Make sure that any build scripts that relied on tsup have been updated accordingly.
24-25: Dependency updates: 'typescript' and 'typescript-transform-paths'.
Ensuring that you explicitly depend on TypeScript^5.7.3and adding"typescript-transform-paths": "^3.5.5"should support enhanced module path transformations. Confirm that these align with your new tsconfig settings and overall project expectations.tsconfig.base.json (4)
43-44: Updated 'lib' configuration for ECMAScript compatibility.
Switching the"lib"value to["ES2022", "DOM", "DOM.Iterable"]harmonizes with the target"ES2022"setting and ensures a more precise set of library features is available during compilation.
48-48: Enabled compiler diagnostics.
The addition of"diagnostics": truewill aid in revealing underlying compilation issues. Ensure that the increased verbosity does not overwhelm routine builds.
51-52: Configured build information and updated path mapping.
Setting"tsBuildInfoFile": "${configDir}/dist/.tsbuildinfo"improves incremental build performance, and updating"paths"to{ "~/*": ["src/*"] }removes redundant relative pathing. Verify that these changes correctly reflect the repository’s directory structure.
54-57: Added plugins for transforming module paths.
Including the"typescript-transform-paths"plugin—with one instance running post-declarations—ensures that module paths are correctly resolved in both source and declaration outputs. Confirm that this transformation aligns with your intended module resolution strategy.
Summary by CodeRabbit
New Features
Chores